package ui.activity.profit.biz;

import base.BaseBiz;
import base.BaseResp;
import coom.BaseSubscribe;
import coom.RetrofitHelp;
import okhttp3.RequestBody;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
import ui.model.AccountMoneyInfo;
import ui.model.IntegralBuyResBean;
import ui.model.ItemsInfo;
import ui.model.WxBean;

/**
 * Created by chenjian on 19/2/26.
 * 1
 */

public class WXPayBiz extends BaseBiz {

    /**
     * 获取钱包信息
     */
    public void getUserIncome(final Callback<ItemsInfo<AccountMoneyInfo>> callback) {
        com.add(RetrofitHelp.getSecretApi().accountInfo()
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseSubscribe<BaseResp<ItemsInfo<AccountMoneyInfo>>>() {

                    @Override
                    public void onSuccess(Object obj) {
                        callback.onSuccess((ItemsInfo<AccountMoneyInfo>) obj);
                    }

                    @Override
                    public void onFailure(Object obj) {
                        callback.onFailure((ItemsInfo<AccountMoneyInfo>) obj);
                    }
                })
        );
    }

    /**
     * 获取未读消息
     */
    public void WXPay(RequestBody requestBody, final Callback<WxBean> callback) {
        com.add(RetrofitHelp.getSecretApi().wxPay(requestBody)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseSubscribe<BaseResp<WxBean>>() {

                    @Override
                    public void onSuccess(Object obj) {
                        callback.onSuccess((WxBean) obj);
                    }

                    @Override
                    public void onFailure(Object obj) {
                        callback.onFailure((WxBean) obj);
                    }
                })
        );
    }
    public void JFPay(RequestBody requestBody, final Callback<IntegralBuyResBean> callback) {
        com.add(RetrofitHelp.getSecretApi().integralBuy(requestBody)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseSubscribe<BaseResp<IntegralBuyResBean>>() {

                    @Override
                    public void onSuccess(Object obj) {
                        callback.onSuccess((IntegralBuyResBean) obj);
                    }

                    @Override
                    public void onFailure(Object obj) {
                        callback.onFailure((IntegralBuyResBean) obj);
                    }
                })
        );
    }
    /**
     * 余额获取验证码
     */
    public void yuPay(final Callback<Object> callback) {
        com.add(RetrofitHelp.getSecretApi().getCode()
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseSubscribe<BaseResp<Object>>() {

                    @Override
                    public void onSuccess(Object obj) {
                        callback.onSuccess((Object) obj);
                    }

                    @Override
                    public void onFailure(Object obj) {
                        callback.onFailure((Object) obj);
                    }
                })
        );
    }


    /**
     * 余额获取支付
     */
    public void balancePay(RequestBody requestBody, final Callback<Object> callback) {
        com.add(RetrofitHelp.getSecretApi().balancePay(requestBody)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseSubscribe<BaseResp<Object>>() {

                    @Override
                    public void onSuccess(Object obj) {
                        callback.onSuccess((Object) obj);
                    }

                    @Override
                    public void onFailure(Object obj) {
                        callback.onFailure((Object) obj);
                    }
                })
        );
    }

    /**
     * 获取是否设置提现密码
     */
    public void getPwd(final Callback<Boolean> callback) {
        com.add(RetrofitHelp.getSecretApi().payPassWord()
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseSubscribe<BaseResp<Boolean>>() {

                    @Override
                    public void onSuccess(Object obj) {
                        callback.onSuccess((Boolean) obj);
                    }

                    @Override
                    public void onFailure(Object obj) {
                        callback.onFailure((Boolean) obj);
                    }
                })
        );
    }


}
